package com.xiaoc.bulldozer.common;

import java.util.HashMap;
import java.util.Map;

import com.google.common.collect.Maps;

public class Constant {

    public static final String COOKIE_SESSION_ID = "sessionId";
    public static final String COOKIE_SESSION_USERTYPE = "userType";

    public static final long JM_MINI_TIME = 1554048000000L;
    public static final String JM_MINI_TIME_STR = "2019-04-01";

    public static final long SX_MINI_TIME = 1541001600000L;
    public static final String SX_MINI_TIME_STR = "2018-11-01";

    public static final String USER_ID = "userId";
    public static final String START_TIME = "startTime";
    public static final long DEFAULT_SESSION_TIME = 0L;
    /**
     * set session 过期频率
     */
    public static final long SESSION_REFRESH_FREQUENCY = 2;

    /**
     * 显示与实际处理状态隐射关系
     */
    public static Map<Integer, Integer> STATUS_MAPPING = Maps.newHashMap();

    public static Map<Integer, String> LOAN_STATUS_NAME_MAPPING = Maps.newHashMap();


    /**
     * 是
     */
    public static final String YES = "1";

    /**
     * 否
     */
    public static final String NO = "0";

    public static final String SHARE = "2";

    /**
     * 可用状态
     */
    public static final int ENABLE = 1;

    /**
     * 禁用状态
     */
    public static final int DISABLE = 0;

    public static final Integer ONE = 1;
    public static final Integer TWO = 2;
    public static final Integer THREE = 3;

    /**
     * 成功结束状态
     */
    public static final int SUCCESS_DISABLE = 2;

    /**
     * 默认缓存过期时间
     */
    public static final long SESSION_TIMEOUT = 86400 * 1000 * 3l;

    /**
     * 注册过期时间
     */
    public static final long REGIST_TIMEOUT = 3600 * 1000 * 24;

    /**
     * 最多注册次数
     */
    public static final int REGIST_MAX_COUNT = 3;

    /**
     * 恶意申贷过期时间
     */
    public static final long BAND_LOAN_TIMEOUT = 3600 * 1000 * 24;

    /**
     * 恶意申贷次数限制
     */
    public static final int BAND_LOAN_MAX_COUNT = 3;

    /**
     * 手机银行下载链接短信过期时间
     */
    public static final long PHONE_BANK_DOWNLOAD_LINK_TIMEOUT = 3600 * 1000 * 24;

    /**
     * 手机银行下载链接短信次数限制
     */
    public static final int PHONE_BANK_DOWNLOAD_LINK_MAX_COUNT = 3;

    /**
     * 默认微信用户昵称
     */
    public static final String DEFAULT_WX_NICKNAME = "微信用户";

    /**
     * 红包额外奖励金额
     */
    public static final int AWARD_ADDITIONAL_FEE_MAX = 30;

    /**
     * 身份证长度
     */
    public static final int IDENTITYNO_LENGTH = 18;


    /**
     * 默认时间戳过期时间
     */
    public static final long TIMESTAMP_TIMEOUT = 1000 * 10L;


    /**
     * 广水region parent_id
     */
    public static final int GUANGSHUI_REGION_PARENT_ID = 4213;


    /**
     * 贷款状态。0为提交, 1为处理中, 2为审核通过, 3为审核未通过
     * <p>
     * //荆门等无城乡E通 贷款状态：
     * 0.已提交
     * 10.处理中
     * 20：初审已拒绝
     * 30：初审已通过
     * 40：复审已拒绝
     * 50：复审已通过
     */
    public static class LOAN_STATUS {

        public static final int SUBMIT = 0;
        public static final int HANDLING = 1;
        public static final int SUCCESS = 2;
        public static final int FAIL = 3;

        /**
         * 处理中
         */
        public static final int PROCESSING = 10;

        /**
         * 初审已拒绝
         */
        public static final int FIRST_TRIAL_REFUSE = 20;

        /**
         * 初审已通过
         */
        public static final int FIRST_TRIAL_PASS = 30;

        /**
         * 复审已拒绝
         */
        public static final int SECOND_TRIAL_REFUSE = 40;

        /**
         * 复审已通过
         */
        public static final int SECOND_TRIAL_PASS = 50;
    }

    /**
     * 账户类型 1为用户, 2为渠道经理，3：分享达人
     */
    public static class ACCOUNT_TYPE {
        public static final int USER = 1;
        public static final int MANAGER = 2;
        public static final int SHARER_TELENT = 100;
    }

    /**
     * 账户tag 1为外部用户, 2为内部用户
     */
    public static class ACCOUNT_TAG {
        public static final int EXTERNAL = 1;
        public static final int INNER = 2;
    }

    public static class ACCOUNT_MANAGER_TYPE {
        public static final int FINANCIAL_MANAGER = 1;

    }

    /**
     * 员工类型。1-机关干部、2-渠道经理、3-内部员工
     */
    public static class INNER_TYPE {
        public static final Integer OFFICER = 1;
        public static final Integer MANAGER = 2;
        public static final Integer INNER = 3;
    }


    public static final long MSG_SEND_TIMEOUT = 1 * 60 * 1000L;

    public static final long MSG_VERIFYCODE_TIMEOUT = 5 * 60 * 1000L;

    public static final long ACCESS_TOKEN_SESSION_TIMEOUT = 5 * 60 * 1000L;

    /**
     * smtp地址
     */
    public static final String SMTP_URL = "smtp.url";

    /**
     * smtp账号
     */
    public static final String SMTP_USERNAME = "smtp.username";

    /**
     * smtp密码
     */
    public static final String SMTP_PWD = "smtp.pwd";

    /**
     * smtp密码
     */
    public static final String SMTP_SERVICECODE = "smtp.servicecode";

    /**
     * smtp密码
     */
    public static final String SMTP_PROXY_SERVICECODE = "smtp.proxy.servicecode";

    /**
     * smtp组织代码
     */
    public static final String SMTP_ORGCODE = "smtp.orgcode";

    /**
     * smtp消息类型
     */
    public static final String SMTP_MSGTYPE = "smtp.msgtype";

    /**
     * smtp report flag
     */
    public static final String SMTP_REPORTFLAG = "smtp.reportflag";

    /**
     * smtp发送优先级
     */
    public static final String SMTP_PRIORITY = "smtp.priority";

    /**
     * 图片域名
     */
    public static final String OSS_IMAGE_DOMAIN = "oss.image.domain";

    /**
     * 亲友团类型 1为点赞, 2为注册，3为申贷
     */
    public static class MY_PARTNER_TYPE {
        public static final int LIKE = 1;
        public static final int REGIST = 2;
        public static final int LOAN = 3;
    }

    public static class FINACIAL_PRODUCT {
        public static final int LOAN_ID = 1;
        public static final int DEPOSIT_ID = 2;
        public static final int CREDIT_CARD_ID = 3;
    }

    public static final Integer DEFAULT_MANAGER_ACCOUNT_ID = 1;

    public static final String DEFAULT_CHANNEL_CODE = "1000";

    public static final Map<String, String> DEFAULT_SUBBANK_CODE_MAP = Maps.newHashMap();

    static {
        DEFAULT_SUBBANK_CODE_MAP.put(BankNameConstant.SANXIA_BANK, "00000");

        DEFAULT_SUBBANK_CODE_MAP.put(BankNameConstant.JINGMEN_BANK, "58999");

        DEFAULT_SUBBANK_CODE_MAP.put(BankNameConstant.XIANGYANG_BANK, "00000");

        DEFAULT_SUBBANK_CODE_MAP.put(BankNameConstant.GUANGSHUI_BANK, "00000");
    }

    /**
     * 申贷来源
     */
    public static final String LOAN_SOURCE = "sbank_min_app";

    /**
     * 统计类型。1-注册用户数，2-申贷数
     */
    public static class STATISTIC_TYPE {
        public static final int ACCOUNT = 1;
        public static final int LOAN = 2;
    }

    public static class CREDIT_CARD_STATUS {
        public static final int SUBMIT = 0;
        public static final int HANDLING = 1;
        public static final int SUCCESS = 2;
        public static final int FAIL = 3;
    }

    /**
     * 横幅广告类型。1-首页
     */
    public static class BANNER_TYPE {
        public static final int INDEX = 1;
    }

    static {
        STATUS_MAPPING.put(LOAN_STATUS.SUBMIT, LOAN_STATUS.SUBMIT);
        STATUS_MAPPING.put(LOAN_STATUS.PROCESSING, LOAN_STATUS.HANDLING);
        STATUS_MAPPING.put(LOAN_STATUS.FIRST_TRIAL_PASS, LOAN_STATUS.HANDLING);
        STATUS_MAPPING.put(LOAN_STATUS.FIRST_TRIAL_REFUSE, LOAN_STATUS.FAIL);
        STATUS_MAPPING.put(LOAN_STATUS.SECOND_TRIAL_REFUSE, LOAN_STATUS.FAIL);
        STATUS_MAPPING.put(LOAN_STATUS.SECOND_TRIAL_PASS, LOAN_STATUS.SUCCESS);
    }

    static {
        LOAN_STATUS_NAME_MAPPING.put(LOAN_STATUS.SUBMIT, "已提交");
        LOAN_STATUS_NAME_MAPPING.put(LOAN_STATUS.PROCESSING, "处理中");
        LOAN_STATUS_NAME_MAPPING.put(LOAN_STATUS.FIRST_TRIAL_PASS, "初审已通过");
        LOAN_STATUS_NAME_MAPPING.put(LOAN_STATUS.FIRST_TRIAL_REFUSE, "初审已拒绝");
        LOAN_STATUS_NAME_MAPPING.put(LOAN_STATUS.SECOND_TRIAL_REFUSE, "复审已拒绝");
        LOAN_STATUS_NAME_MAPPING.put(LOAN_STATUS.SECOND_TRIAL_PASS, "复审已通过");
    }

    public static Map<String,String> INTERNET_BANK = new HashMap();

    static {
        INTERNET_BANK.put("presidentName","用户名称");
        INTERNET_BANK.put("phone","用户手机号");
        INTERNET_BANK.put("name","网点名称");
        INTERNET_BANK.put("count","短信条数");
        INTERNET_BANK.put("status","发送状态");
        INTERNET_BANK.put("createTime","发送时间");
        INTERNET_BANK.put("pCode","上级网点号");
    }

    public static Map<String,String> DISTRIBUTE_GATHER = new HashMap();

    static {
        DISTRIBUTE_GATHER.put("name","姓名");
        DISTRIBUTE_GATHER.put("phoneNumber","注册手机号");
        DISTRIBUTE_GATHER.put("managerName","所属渠道经理姓名");
        DISTRIBUTE_GATHER.put("managerPhoneNumber","所属渠道经理手机号");
        DISTRIBUTE_GATHER.put("type","用户类型\n(1注册用户,2渠道经理)");
        DISTRIBUTE_GATHER.put("tag","账号标签\n(1外部用户,2内部员工)");
        DISTRIBUTE_GATHER.put("typeDesc","用户类型");
        DISTRIBUTE_GATHER.put("tagDesc","账号标签");
        DISTRIBUTE_GATHER.put("partnerNum","点赞量");
        DISTRIBUTE_GATHER.put("accountNum","注册量");
        DISTRIBUTE_GATHER.put("loanNum","申贷量");
        DISTRIBUTE_GATHER.put("loanPassNum","申贷通过量");
        DISTRIBUTE_GATHER.put("totalCount","金额（元）");
        DISTRIBUTE_GATHER.put("totalAmount","金额（元）");
        DISTRIBUTE_GATHER.put("remark","备注");
    }

    /**
     * 短信类型
     */
    public static class SEND_SMS_TYPE {
        //手机银行
        public static final int MOBILE_BANK_SMS = 3;
    }

    public static class ADD_LIKE_TYPE {
        public static final String IS_ADD_LIKE = "您已帮他点过赞了";
        public static final String EXPIRED_ADD_LIKE = "晚了一步，好友红包溜走了";
        public static final String SUCCESS_ADD_LIKE = "晚了一步，好友已领取红包";
    }

    /**
     * 停止发短信时间
     */
    public static final int STOP_SEND_SMS_HOUR = 21;

    /**
     * parentUserId缓存过期时间 一天
     */
    public static final long PARENT_USER_ID_TIMEOUT = 86400000L;


    /**
     * parentUserId缓存过期时间 一天
     */
    public static final long DISTRIBUTE_TYPE_TIMEOUT = 86400000L;

    /**
     * 分享背景图名称
     */
    public static final String DISTRIBUTE_BG_IMG = "discutor_bg.jpg";


    public static final String ERROR_MSG = "errorMsg";

    public static final String SYSTEM_TYPE = "bulldozer";//系统类型
    public static class CODE_TYPE {

        public static final String REGISTER = "1";//注册验证码
        public static final String APPOINTMENT = "2";//预约验证码
        public static final Integer CASH = 3;//现金奖励
        public static final Integer AWARD_EXPIRE = 4;//红包过期
        public static final Integer AWARD_FINISH = 5;//红包到账
        public static final Integer REGISTER_SUCCESS = 6;//注册成功
    }
}
